package org.textreport.lang;

import org.textreport.core.ExecutionContext;

public class TextExpression implements Expression {
	private String text;
	private int sourceLine;
	private Expression parent;

	public TextExpression(String text, Expression parent) {
		this.text = text;
		this.parent = parent;
	}
	
	@Override
	public void eval(ExecutionContext ctx) {
		ctx.getOut().add(text);
	}

	@Override
	public boolean hasBody() {
		return false;
	}

	@Override
	public void addBodyExpression(Expression e) {
	}

	@Override
	public String toString() {
		return "TextExpression [text=" + text + "]";
	}

	@Override
	public int getSourceLine() {
		return sourceLine;
	}

	@Override
	public void setSourceLine(int line) {
		sourceLine = line;
	}

	@Override
	public Expression getParent() {
		return parent;
	}

}
